use std::fs::{File, OpenOptions};
use std::io::Read;

pub fn file_demo() -> std::io::Result<()> {
  test_file_2()
}

pub fn test_file() -> std::io::Result<()> {
  let mut file = File::open("foo.txt")?;
  let mut contents = String::new();
  file.read_to_string(&mut contents)?;
  assert_eq!(contents, "Hello, world!");
  let mut buf: &mut [u8] = &mut [];
  let ret = file.read(&mut buf);
  println!("file_demo>ret={:?}", ret);
  Ok(())
}

pub fn test_file_2() -> std::io::Result<()> {
  let b = std::path::Path::new("fp").exists();
  println!("{}", b);
  Ok(())
}